﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CircuitBoardApplication.Classes.Components.Gates
{
    class gateNOT : Gate
    {
        public gateNOT(int id, String type, int value, int x, int y)
            : base(id, type, value, x, y)
        {
            ID = id;
            Type = type;
            Value = value;
            X = x;
            Y = y;
        }


        public override void DrawItself(System.Drawing.Graphics gr, System.Windows.Forms.ImageList il)
        {
            int diameter = 2 * ComponentMain.radius;
            gr.DrawImage(il.Images[3], this.X - ComponentMain.radius, this.Y - ComponentMain.radius, diameter, diameter);
        }

        public override int Calculate()
        {
            if (Value == 1)
                Value = 0;
            else if (Value == 0)
                Value = 1;
            return Value;
        }
    }
}
